import 'package:flutter/material.dart';
import 'package:fluro/fluro.dart';
import '../flu_widget_router_handle.dart';

class LicenseIndex extends StatelessWidget {
  const LicenseIndex({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: AppBar(
        title: const Text('AboutDialog'),
      ),
      body: Padding(
        padding: const EdgeInsets.all(32),
        child: Center(
          child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                buildButton(
                  text: 'show about dialog',
                  onClicked: () => showAboutDialog(
                    context: context,
                    applicationName: 'FlutterExample',
                    applicationIcon: Image.asset('assets/images/test001.png', height: 100, width: 100),
                    applicationVersion: '0.0.1',
                    applicationLegalese: 'Copyright ${DateTime.now().year} 杭州天谷科技, \n古人云: 不俗即仙骨，多情乃佛心',
                    children: [
                      Container(height: 30, color: Colors.red),
                      Container(height: 30, color: Colors.green),
                      Container(height: 30, color: Colors.blue),
                    ],
                  ) 
                ),
                const SizedBox(height: 24),
                buildButton(
                  text: 'Simple Licenses', 
                  onClicked: () => FluroRouter.appRouter.navigateTo(context, licenseSimplePage)
                ),
                const SizedBox(height: 24),
                buildButton(
                  text: 'Registry Licenses',
                  onClicked: () => FluroRouter.appRouter.navigateTo(context, licenseRegistryPage)
                ),
                const SizedBox(height: 24),
                buildButton(
                  text: 'Custom Licenses',
                  onClicked: () => FluroRouter.appRouter.navigateTo(context, licenseCustomPage)
                ),
              ],
            ),
        ),
      ),
    );
  }
  Widget buildButton({
    required String text,
    required VoidCallback onClicked,
  }) => ElevatedButton(
    onPressed: onClicked, 
    child: Text(text, style: const TextStyle(fontSize: 20)),
    style: ElevatedButton.styleFrom(minimumSize: const Size.fromHeight(50)),
  );
}